/*******************************************************************************

* 					  Evidence cultures in ministries		 				   *
					Johan Christensen & Stine Hesstvedt
*								Final draft									   *
*								   2024										   *

********************************************************************************/

cd "C:\Users\stinhess\Dropbox\Dokumenter\1. Prosjekter\1. INFLUEX\1. Papers\Special issue P&S - Evidence use in ministries\Figurer og tabeller\finalversion"


********************************************************************************
* Correlation tables and descriptive stats
********************************************************************************

* Correlation and descriptive stats
use "correlations.dta", replace
rename ministry_new ministry
merge m:m  ministry using "ministry_variables.dta"
drop if ministry==.

summ dimension1 dimension2 capacity1 capacity2 capacity3 capacity4  econ  contest perc_aca samlemaal_p100 rep_com rep_uni rep_inst rep_cons rep_nou wp_nor_govres wp_nor_indres wp_nor_acares wp_int_acares wp_cons ref_total

collapse (mean) dimension1 dimension2 capacity1 capacity2 capacity3 capacity4  econ  contest perc_aca samlemaal_p100 rep_com rep_uni rep_inst rep_cons rep_nou wp_nor_govres wp_nor_indres wp_nor_acares wp_int_acares wp_cons ref_total, by(ministry)

corr dimension1 dimension2 econ  contest perc_aca samlemaal_p100 rep_com rep_uni rep_inst rep_cons rep_nou wp_nor_govres wp_nor_indres wp_nor_acares wp_int_acares wp_cons ref_total

corr dimension1 dimension2 econ  contest perc_aca samlemaal_p100 rep_com rep_uni rep_inst rep_cons rep_nou wp_nor_govres wp_nor_indres wp_nor_acares wp_int_acares wp_cons ref_total capacity1 capacity2 capacity3 capacity4

corr dimension2  capacity1 capacity2 capacity3 capacity4

corr dimension1 capacity1 capacity2 capacity3 capacity4




********************************************************************************
* Figures
********************************************************************************

* Figure 1   *******************************************************************
*Total number of references to research and analysis per 100 pages of white papers. Per ministry, 2000-2020.
use "correlations.dta", replace
drop if ministry==.
set scheme plotplainblind

use stm.dta, replace
set scheme plotplain
collapse (mean) freq samlemaal_p100, by(ministry_new)
gen samle = int(samlemaal_p100)
graph bar samle, over(ministry_new, label(angle(90) labsize(small)) sort((mean) samle) descending) ///
 blabel(total) ///
 ylab(0(10)50) ytitle("Mean number of citations per 100 pages", size(small)) ///
  note("Time period 2000-2020", size(vsmall))
graph save "dim1.2_oversikt.gph", replace
graph export "C:\Users\stinhess\Dropbox\Dokumenter\1. Prosjekter\1. INFLUEX\1. Papers\Special issue P&S - Evidence use in ministries\Figurer og tabeller\finalversion\figure1.png", replace



* Figure 2   *******************************************************************
* Member composition of Official Norwegian Commissions. Share of members belonging to a certain category. Average numbers per ministry, 2000-2020.
set scheme plotplainblind
use nous.dta, replace
collapse (mean) perc_aca perc_civil perc_pubempl perc_ig perc_priv perc_polit, by(ministry_new)

gen p_aca = int(perc_aca*100)
gen p_civil = int(perc_civil*100)
gen p_pubempl = int(perc_pubempl*100)
gen p_ig = int(perc_ig*100)
gen p_priv = int(perc_priv*100)
gen p_polit = int(perc_polit*100)

graph bar p_aca p_civil p_pubempl p_ig p_priv p_polit, by(ministry_new, legend(pos(3)) note("Time period 1999-2020, policy commissions (legal commissions excluded)", size(vsmall))) ///
 blabel(total) ///
 ylab(0(20)100) ytitle("Percent of members", size(small)) ///
 legend(order(1 "Researchers" 2 "Ministry civil servants" 3 "Public employees" 4 "Interest groups" 5 "Private sector employees"  6 "Politicians") size(vsmall) col(1) pos(3))
 
graph save "new_nous_share_members.gph", replace
graph export "C:\Users\stinhess\Dropbox\Dokumenter\1. Prosjekter\1. INFLUEX\1. Papers\Special issue P&S - Evidence use in ministries\Figurer og tabeller\finalversion\figure2.png", replace



*Figure 3   *********************************************************************
* Types of commissioned reports. Shares per ministry, 2000-2020. 

use allreports.dta, replace

collapse (sum) freq by_nou by_commission by_university by_institute by_consultancy by_agency by_ministry, by(ministry_new)

gen p_com = int((by_commission/freq)*100)
gen p_uni = int((by_university/freq)*100)
gen p_inst = int((by_institute/freq)*100)
gen p_cons = int((by_consultancy/freq)*100)
gen p_agency = int((by_agency/freq)*100)
gen p_ministry = int((by_ministry/freq)*100)
gen p_nou = int((by_nou/freq)*100)


graph bar p_nou p_com p_uni p_inst  p_cons p_agency, by(ministry_new, legend(pos(3)) note("Time period 2000-2020", size(vsmall))) ///
 blabel(total) ///
 ylab(0(20)100) ytitle("Share of reports written by", size(small)) ///
 legend(order(1 "Offical commission" 2 "Expert and working groups" 3 "University research" 4 "Research institute report" 5 "Consultancy" 6 "Agency report") size(vsmall) col(1) pos(4))
graph save "allreports_shares_by.gph", replace
graph export "C:\Users\stinhess\Dropbox\Dokumenter\1. Prosjekter\1. INFLUEX\1. Papers\Special issue P&S - Evidence use in ministries\Figurer og tabeller\finalversion\figure3.png", replace



* Figure 4   *******************************************************************
* Types of documents referenced in white papers. Share of references. Per ministry, 2000-2020.
use "stm.dta", replace
collapse (sum) pages ref_total nor_policydoc nor_govres nor_indres nor_acares nor_think cons intgr media for_policydoc intorg_policydoc int_acares int_indres, by(ministry_new)

gen p_nor_policydoc = int((nor_policydoc/ref_total)*100)
gen p_nor_govres  = int((nor_govres /ref_total)*100)
gen p_nor_indres  = int((nor_indres/ref_total)*100)
gen p_nor_acares = int((nor_acares/ref_total)*100)
gen p_nor_think = int((nor_think/ref_total)*100)
gen p_intgr = int((intgr/ref_total)*100)
gen p_media = int((media/ref_total)*100)
gen p_for_policydoc = int((for_policydoc/ref_total)*100)
gen p_intorg_policydoc = int((intorg_policydoc/ref_total)*100)
gen p_int_acares = int((int_acares/ref_total)*100)
gen p_cons = int((cons/ref_total)*100)
gen p_int_indres = int((int_indres/ref_total)*100)


graph bar p_nor_policydoc p_nor_govres p_nor_indres p_nor_acares p_cons p_intgr p_for_policydoc p_intorg_policydoc p_int_acares, by(ministry_new, legend(pos(3)) note("Time period 1999-2020, excl. special WPs (N=817)", size(vsmall))) ///
 blabel(total) ///
 ylab(0(20)100) ytitle("Shares of references", size(small)) ///
 legend(order(1 "NO public policy document" 2 "NO research agency" 3 "NO independent research institute" 4 "NO academic research" 5 "Consultancy report" 5 "Interest group document" ///
 7 "Foreign policy doc." 8 "International organization" 9 "International academic research") size(vsmall) col(1) pos(4))
graph export "C:\Users\stinhess\Dropbox\Dokumenter\1. Prosjekter\1. INFLUEX\1. Papers\Special issue P&S - Evidence use in ministries\Figurer og tabeller\finalversion\figure4.png", replace



*Figure 5  *********************************************************************
* Emphasis on evidence and evidence type, dimensions

use "correlations.dta", replace
drop if ministry==.
set scheme plotplainblind
twoway (scatter dimension1 dimension2, mlabel(ministry)),  ///
ytitle("Dimension 1: Emphasis on evidence") xtitle("Dimension 2: Evidence type") ///
ylab(0(10)50) xlab(0(20)100) ///
 xmlab(0"Applied" 100"Academic", labgap(10)) ///
ymlab(0"Less" 50"More", labgap(8))
 graph export "C:\Users\stinhess\Dropbox\Dokumenter\1. Prosjekter\1. INFLUEX\1. Papers\Special issue P&S - Evidence use in ministries\Figurer og tabeller\finalversion\figure5 old.png", replace


* Figure 6, 7, 8, 9 ************************************************************
use "correlations.dta", replace
rename ministry_new ministry
merge m:m  ministry using "ministry_variables.dta"
drop if ministry==.
set scheme plottig

collapse (mean) capacity1 capacity2 capacity3 capacity4  econ contest dimension1 dimension2, by(ministry)

* Dimension 1 *********
*Capacity 
twoway (scatter dimension1 capacity1, mcolor(%50) mlabel(ministry)) (lfit dimension1 capacity1 , lwidt(medium)), ///
 ytitle("Dimension 1: Emphasis on evidence") ylab(0(20)100)  xlab(0(20)100) xtitle("Capacity") title("Research budget") legend(order(1 "Mean" 2 "Trend line") pos(6) row(1)) ylab(0(10)50) ymlab(0"Less" 50"More", labgap(8))
 graph save 1.gph, replace
graph export "capacity1.png", replace

twoway (scatter dimension1 capacity2, mcolor(%50) mlabel(ministry)) (lfit dimension1 capacity2, lwidt(medium)), ///
 ytitle("Dimension 1: Emphasis on evidence") ylab(0(20)100)  xlab(0(20)100)  xtitle("Capacity") title("Access to research") legend(order(1 "Mean" 2 "Trend line") pos(6) row(1)) ylab(0(10)50) ymlab(0"Less" 50"More", labgap(8))
 graph save 2.gph, replace
graph export "capacity2.png", replace

twoway (scatter dimension1 capacity3, mcolor(%50) mlabel(ministry)) (lfit dimension1 capacity3, lwidt(medium)), ///
 ytitle("Dimension 1: Emphasis on evidence") ylab(0(20)100)  xlab(0(20)100) xtitle("Capacity") title("Research unit or research advisor") legend(order(1 "Mean" 2 "Trend line") pos(6) row(1)) ylab(0(10)50)  ymlab(0"Less" 50"More", labgap(8))
 graph save 3.gph, replace
graph export "capacity3.png", replace

twoway (scatter dimension1 capacity4, mcolor(%50) mlabel(ministry)) (lfit dimension1 capacity4, lwidt(medium)), ///
 ytitle("Dimension 1: Emphasis on evidence") ylab(0(20)100)  xlab(0(20)100) xtitle("Capacity") title("Time to read research") legend(order(1 "Mean" 2 "Trend line") pos(6) row(1)) ylab(0(10)50) ymlab(0"Less" 50"More", labgap(8))
 graph save 4.gph, replace
graph export "capacity4.png", replace


*Contestation
twoway (scatter dimension1 contest, mcolor(%50) mlabel(ministry)) (lfit dimension1 contest , lwidt(medium)), ///
 ytitle("") xlab(0(.1)0.5) xtitle("Ministry survey: High level of contestation %") title("Dimension 1: Emphasis on evidence") legend(order(1 "Mean" 2 "Trend line") pos(6) row(1)) ylab(0(10)50) ymlab(0"Less" 50"More", labgap(8))
graph save "Dimension1_contestation.gph", replace


*Econ
twoway (scatter  dimension1 econ, mcolor(%50) mlabel(ministry)) (lfit  dimension1 econ, lwidt(medium)), ///
 ytitle("") xlab(0(.1).6)  xtitle("Ministry survey:  Share of economists") title("Dimension 1: Emphasis on evidence") legend(order(1 "Mean" 2 "Trend line") pos(6) row(1)) ylab(0(10)50) ymlab(0"Less" 50"More", labgap(8))
graph save Dimension1_econ.gph, replace

graph combine 1.gph 2.gph 3.gph 4.gph
graph export "C:\Users\stinhess\Dropbox\Dokumenter\1. Prosjekter\1. INFLUEX\1. Papers\Special issue P&S - Evidence use in ministries\Figurer og tabeller\finalversion\Figure7.png", replace


* Dimension 2  *********
use "correlations.dta", replace
rename ministry_new ministry
merge m:m  ministry using "ministry_variables.dta"
drop if ministry==.


collapse (mean) capacity1 capacity2 capacity3 capacity4  econ contest dimension1 dimension2, by(ministry)
																								
twoway (scatter dimension2 capacity1, mcolor(%50) mlabel(ministry)) (lfit dimension2 capacity1 , lwidt(medium)), ///
 ytitle("Dimension 2: Evidence type") ylab(0(20)100)  xlab(0(20)100) xtitle("Capacity") title("Research budget") legend(order(1 "Mean" 2 "Trend line") pos(6) row(1)) ymlab(0"Applied" 100"Academic", labgap(8))
 graph save 1.gph, replace
graph export "capacity1.png", replace

twoway (scatter dimension2 capacity2, mcolor(%50) mlabel(ministry)) (lfit dimension2 capacity2, lwidt(medium)), ///
 ytitle("Dimension 2: Evidence type") ylab(0(20)100)  xlab(0(20)100)  xtitle("Capacity") title("Access to research") legend(order(1 "Mean" 2 "Trend line") pos(6) row(1)) ymlab(0"Applied" 100"Academic", labgap(8))
 graph save 2.gph, replace
graph export "capacity2.png", replace

twoway (scatter dimension2 capacity3, mcolor(%50) mlabel(ministry)) (lfit dimension2 capacity3, lwidt(medium)), ///
 ytitle("Dimension 2: Evidence type") ylab(0(20)100)  xlab(0(20)100) xtitle("Capacity") title("Research unit or research advisor") legend(order(1 "Mean" 2 "Trend line") pos(6) row(1)) ymlab(0"Applied" 100"Academic", labgap(8))
 graph save 3.gph, replace
graph export "capacity3.png", replace

twoway (scatter dimension2 capacity4, mcolor(%50) mlabel(ministry)) (lfit dimension2 capacity4, lwidt(medium)), ///
 ytitle("Dimension 2: Evidence type") ylab(0(20)100)  xlab(0(20)100) xtitle("Capacity") title("Time to read research") legend(order(1 "Mean" 2 "Trend line") pos(6) row(1)) ymlab(0"Applied" 100"Academic", labgap(8))
 graph save 4.gph, replace
graph export "capacity4.png", replace

graph combine 1.gph 2.gph 3.gph 4.gph
graph export "C:\Users\stinhess\Dropbox\Dokumenter\1. Prosjekter\1. INFLUEX\1. Papers\Special issue P&S - Evidence use in ministries\Figurer og tabeller\finalversion\figure8.png", replace



*Contestation
twoway (scatter dimension2 contest, mcolor(%50) mlabel(ministry)) (lfit dimension2 contest , lwidt(medium)), ///
 ytitle("") xlab(0(.1)0.5) ylab(0(20)100) xtitle("Ministry survey: High level of contestation %") title("Dimension 2: Evidence type") legend(order(1 "Mean" 2 "Trend line") pos(6) row(1)) ymlab(0"Applied" 100"Academic", labgap(8))
graph save Dimension2_contestation.gph, replace


*Econ
twoway (scatter  dimension2 econ, mcolor(%50) mlabel(ministry)) (lfit  dimension2 econ, lwidt(medium)), ///
 ytitle("") xlab(0(.1).6) ylab(0(20)100)  xtitle("Ministry survey:  Share of economists") title("Dimension 2: Evidence type") legend(order(1 "Mean" 2 "Trend line") pos(6) row(1)) ymlab(0"Applied" 100"Academic", labgap(8)) 
graph save Dimension2_econ.gph, replace




**** Graph export
graph combine Dimension1_contestation.gph Dimension2_contestation.gph
graph export "C:\Users\stinhess\Dropbox\Dokumenter\1. Prosjekter\1. INFLUEX\1. Papers\Special issue P&S - Evidence use in ministries\Figurer og tabeller\finalversion\figure6.png", replace


graph combine  Dimension1_econ.gph  Dimension2_econ.gph
graph export "C:\Users\stinhess\Dropbox\Dokumenter\1. Prosjekter\1. INFLUEX\1. Papers\Special issue P&S - Evidence use in ministries\Figurer og tabeller\finalversion\Figure9.png", replace



*Appendix **********************************************************************


*Figure A1
use nous.dta, replace
drop if lovutvalg==1 
collapse (sum) num_aca num_civil num_pubempl num_ig num_priv num_polit, by(ministry_new)

graph bar num_aca num_civil num_pubempl num_ig num_priv num_polit, by(ministry_new, legend(pos(3)) note("Time period 1999-2020, policy commissions (legal commissions excluded)", size(vsmall))) ///
 blabel(total, size(small)) ///
 ylab(0(100)400) ytitle("Total number of members", size(medium)) ///
 legend(order(1 "Researchers" 2 "Ministry civil servants" 3 "Public employees" 4 "Interest groups" 5 "Private sector employees"  6 "Politicians") size(vsmall) col(1) pos(3))
graph export "C:\Users\stinhess\Dropbox\Dokumenter\1. Prosjekter\1. INFLUEX\1. Papers\Special issue P&S - Evidence use in ministries\Figurer og tabeller\finalversion\Appendix_FigureA1.png", replace

* Figure A2
use allreports.dta, replace
collapse (sum) by_nou by_commission by_university by_institute by_consultancy by_agency, by(ministry_new)

graph bar by_nou by_commission by_university by_institute by_consultancy by_agency , by(ministry_new, legend(pos(3)) note("Time period 2000-2020", size(vsmall))) ///
 blabel(total) ///
 ylab(0(100)300) ytitle("Author of report, total number", size(small)) ///
 legend(order(1 "Offical commission" 2 "Expert and working groups" 3 "University research" 4 "Research institute report" 5 "Consultancy" 6 "Agency report") size(vsmall) col(1) pos(4))
graph export "C:\Users\stinhess\Dropbox\Dokumenter\1. Prosjekter\1. INFLUEX\1. Papers\Special issue P&S - Evidence use in ministries\Figurer og tabeller\finalversion\Appendix_FigureA2.png", replace


* Figure A3


* Per ministry: Absolute numbers of type of reference per 100 pages
use "stm.dta", replace
collapse (sum) pages ref_total nor_policydoc nor_govres nor_indres nor_acares nor_think cons intgr media for_policydoc intorg_policydoc int_acares int_indres, by(ministry_new)

gen p_nor_policydoc = int((nor_policydoc/pages)*100)
gen p_nor_govres  = int((nor_govres /pages)*100)
gen p_nor_indres  = int((nor_indres/pages)*100)
gen p_nor_acares = int((nor_acares/pages)*100)
gen p_nor_think = int((nor_think/pages)*100)
gen p_intgr = int((intgr/pages)*100)
gen p_media = int((media/pages)*100)
gen p_for_policydoc = int((for_policydoc/pages)*100)
gen p_intorg_policydoc = int((intorg_policydoc/pages)*100)
gen p_int_acares = int((int_acares/pages)*100)
gen p_cons = int((cons/pages)*100)
gen p_int_indres = int((int_indres/pages)*100)


graph bar p_nor_policydoc p_nor_govres p_nor_indres p_nor_acares p_cons p_intgr p_for_policydoc p_intorg_policydoc p_int_acares, by(ministry_new, legend(pos(3)) note("Time period 1999-2020", size(vsmall))) ///
 blabel(total, size(vsmall)) ///
 ylab(0(5)30) ytitle("Type of document, references per 100 pages", size(small)) ///
 legend(order(1 "NO public policy document" 2 "NO research agency" 3 "NO independent research institute" 4 "NO academic research" 5 "Consultancy report" 5 "Interest group document" ///
 7 "Foreign policy doc." 8 "International organization" 9 "International academic research") size(vsmall) col(1) pos(4))
graph export "C:\Users\stinhess\Dropbox\Dokumenter\1. Prosjekter\1. INFLUEX\1. Papers\Special issue P&S - Evidence use in ministries\Figurer og tabeller\finalversion\Appendix_FigureA3.png", replace






